home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
unixSyscall
/
RCS
/
umask.c,v
< prev
next >
Wrap
Text File
|
1991-12-10
|
2KB
|
109 lines
head 1.1;
branch ;
access ;
symbols sprited:1.1.1;
locks ; strict;
comment @ * @;
1.1
date 88.06.19.14.32.09; author ouster; state Exp;
branches 1.1.1.1;
next ;
1.1.1.1
date 91.12.10.16.30.49; author kupfer; state Exp;
branches ;
next ;
desc
@@
1.1
log
@Initial revision
@
text
@/*
* umask.c --
*
* Procedure to map from Unix umask system call to Sprite.
*
* Copyright 1986 Regents of the University of California
* All rights reserved.
*/
#ifndef lint
static char rcsid[] = "$Header: umask.c,v 1.1 87/03/23 16:33:07 douglis Exp $ SPRITE (Berkeley)";
#endif not lint
#include "sprite.h"
#include "fs.h"
#include "compatInt.h"
/*
* These are the bits to invert and pass to the Sprite system call.
*/
#define PERMISSION_MASK 0777
/*
*----------------------------------------------------------------------
*
* umask --
*
* Procedure to map from Unix umask system call to Sprite
* Fs_SetDefPerm.
*
* Results:
* On success, the former value of umask is returned. If
* Fs_SetDefPerm returns an error, UNIX_ERROR is returned and the
* actual error code is stored in errno.
*
* Side effects:
* The default protection of files created by the current process
* is changed.
*
*----------------------------------------------------------------------
*/
int
umask(newMask)
int newMask;
{
ReturnStatus status; /* result returned by Fs_SetDefPerm */
int oldMask;
/*
* Sprite default permissions are the logical NOT of Unix permissions.
*/
newMask = (~newMask) & PERMISSION_MASK;
status = Fs_SetDefPerm(newMask, &oldMask);
if (status != SUCCESS) {
errno = Compat_MapCode(status);
return(UNIX_ERROR);
} else {
oldMask = (~oldMask) & PERMISSION_MASK;
return(oldMask);
}
}
@
1.1.1.1
log
@Initial branch for Sprite server.
@
text
@d11 1
a11 1
static char rcsid[] = "$Header: /sprite/src/lib/c/unixSyscall/RCS/umask.c,v 1.1 88/06/19 14:32:09 ouster Exp $ SPRITE (Berkeley)";
@